package cn.com.websocket.util;

import cn.com.websocket.po.Message;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/***
 ** @category 请用一句话描述这个类的用途
 ** @author qing.yunhui
 ** @email: qingyh@glodon.com
 ** @createTime: 2021-08-12 11:40
 **/
public class HistoryUtil {

    private static Map<String, List<Message>> syncServiceMap = new ConcurrentHashMap<>();

    public static List<Message> getHistory(String key){
        return syncServiceMap.get(key);
    }

    public static void set(String key,List<Message> messages){
        if(!syncServiceMap.containsKey(key)){
            syncServiceMap.put(key,messages);
        }
    }

}
